import os
from git import Repo

# 创建本地路径用来存放远程仓库下载的代码
dirPath = os.path.join('NB3')

# file1 = open("gitlog.txt", "w", encoding="utf8")
# file1.write(gitlog)  # 写入文件

file2 = open('gitlog.txt',mode='r')

content = file2.read()

print(content)

# file1.close()

# Note.writelines(['hello\n','world\n','你好\n','CSDN\n','威武\n']) #\n 换行符

#
#
# repo = Repo(dirPath)
# repo.git.pull()
#
# branches = repo.remote().refs
# for item in branches:
#     print(item.remote_head)

# 获取所有分支
# branches = repo.remote().refs
# for item in branches:
#     print(item.remote_head)


# 创建一个git文件夹
# Repo.init('NB2')
# Repo.index.add(['a.txt'])
# 将缓存区文件提交到版本库
# Repo.inex.commit('update new')

# 拉取代码
# Repo.clone_from('https://github.com/DominicJi/TeachTest.git',to_path=download_path,branch='master')

# remote = Repo.create_remote(name='gitlab', url='git@gitlab.com:USER/REPO.git')


# remote_101 = Repo.clone_repo.remote()

# clone_repo = Repo.clone_from(url='root@101.133.170.175:/root/YOYOFile/Git_Server/TCP_Hardware_Server.git',to_path='./NB/')

#后面跟需要拉取的分支名称